package com.lch.thread.vip._volatile;

/**
 * @author: liuchenhui
 * @create: 2019-05-14 21:31
 **/
public class VolatileTest {

    public static volatile boolean stop = false;

    public static int i = 0;

    public static void main(String[] args) throws InterruptedException {

        Thread thread = new Thread(() -> {
            while (!stop) {
                i++;
            }
        });
        thread.start();

        Thread.sleep(1000);
        stop = true;
    }
}
